package com.atguigu.gmall.search.pojo;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;
import java.util.List;

/**
 * @author mahaijun
 * @version 1.0.0
 * @ClassName Goods.java
 * @Description TODO
 * @createTime 2021年11月08日 17:41:00
 */
@Data
@Document(indexName = "goods",type = "info",shards = 3,replicas = 2)
public class Goods {
    //商品列表所需字段
    @Id
    @Field(type = FieldType.Long)
    private Long skuId;
    @Field(type = FieldType.Text ,analyzer = "ik_max_word")
    private String title;
    @Field(type = FieldType.Keyword ,index=false)
    private String subtitle;
    @Field(type=FieldType.Double )
    private Double price ;
    @Field(type = FieldType.Keyword ,index=false)
    private String defaultImage;
    //排序 分页 过滤
    @Field(type = FieldType.Long)
    private Long sales  =  0L;
    @Field(type= FieldType.Date)
    private Date creatTime;
    @Field(type = FieldType.Boolean)
    private Boolean store = false;
    //综合过滤条件
    //品牌相关字段
    @Field(type = FieldType.Long)
    private Long brandId;
    @Field(type = FieldType.Keyword)
    private String brandName;
    @Field(type = FieldType.Keyword)
    private String logo;
    //分类
    @Field(type = FieldType.Long)
    private Long categoryId;
    @Field(type = FieldType.Keyword)
    private String categoryName;
    //检索类型的规格参数
    @Field(type = FieldType.Nested)
    private List<SearchAttrValueVo> searchAttrs;


}
